home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 47 / Amiga Format AFCD47 (Issue 131, Xmas 1999).iso / -serious- / misc / football_upd / exec / alt_results.rexx < prev    next >
OS/2 REXX Batch file  |  1999-10-04  |  6KB  |  183 lines

  1. /* ***********************************************************************
  2.  
  3.    RESULTS PROGRAM FOR FOOTBALL REXX SUITE
  4.   ---------------------------------------
  5.                    Copyright  Mark Naughton 1996
  6.  
  7.  
  8. Version    Date     History
  9. --------------------------------------------------------------------------
  10.  1.0       270996   First release. Displays all results from 'Teams.sf'
  11.                     file.
  12.  1.1       121196   Updated to get arguments and to use '*.sflearn' to get
  13.                     a true display as '.sf' was in order. Now called as a
  14.                     component of FOOTBALL.
  15.            131196   Added checks for files - if not found, exits without
  16.                     a message.
  17.            211196   Updated and tidied the display.
  18.            190497   Added title to display.
  19.  1.2       060997   Amended to handle new Automatic Scheduling schedules.
  20.                     Removed - new program for this. Formatting needs to be
  21.                     handled properly.
  22.            151297   Tidied display.
  23.            180499   Improved match/fixture display.
  24.            310599   Changed to accommodate extra data in '.sflearn' file.
  25.  1.3       280699   Added and changed code to run the same as the alternative
  26.                     displays for League, to display goal scorers, bookings,
  27.                     substitutes, referees and attendances.
  28.  
  29. **************************************************************************
  30.  
  31. Procedure
  32. ---------
  33.  
  34. 1. Check files exist.
  35. 2. Open file and print all lines without '*' with the exception of
  36.    the league name which is underlined. Build table of player information
  37.    and match information then display.
  38. 3. Close file and exit.
  39.  
  40. ************************************************************************** */
  41. ARG league_file
  42.  
  43. version     = 1
  44. league_file = "Data/" || league_file
  45. input_file  = '.sflearn'
  46. separator   = '*'
  47. separator2  = '**'
  48. home.       = '???'
  49. hct         = 0
  50. away.       = '???'
  51. act         = 0
  52. hmkr        = -1
  53. amkr        = -1
  54.  
  55.  
  56. if exists(league_file || input_file) = 0  then exit
  57.  
  58. spaces = left(" ",30,' ')
  59. do i=1 to 99
  60.    home.i = spaces
  61.    away.i = spaces
  62. end
  63. referee = ""
  64. attend  = ""
  65.  
  66. if open(datafile,league_file || input_file,'r') then do
  67.    say
  68.    say center("Display League Results",78)
  69.    say "-------------------------------------------------------------------------------"
  70.    say
  71.    do while ~eof(datafile)
  72.       line = readln(datafile)
  73.       if pos(separator,line) = 0 then do
  74.          if act = 0 & hct = 0 then do
  75.             say
  76.             say
  77.             say
  78.          end
  79.          if act > 0 | hct > 0 then do
  80.             if hct > act then
  81.                mloop = hct
  82.             else
  83.                mloop = act
  84.             say
  85.             do ii=1 to mloop
  86.                t2 = home.ii
  87.                t3 = away.ii
  88.                say left(strip(t2),30,' ')"          "left(strip(t3),30,' ')
  89.                home.ii = spaces
  90.                away.ii = spaces
  91.             end
  92.             say
  93.             if referee ~= "" then
  94.                say "Referee    : "referee
  95.             if attend ~= "" then
  96.                say "Attendance : "attend
  97.             referee = ""
  98.             attend  = ""
  99.             say
  100.             say
  101.             say
  102.             act = 0
  103.             hct = 0
  104.          end
  105.          say line
  106.       end
  107.       else do
  108.          if pos(separator2,line) > 0 then do
  109.             say subword(line,2)
  110.             uline = ''
  111.             do i=1 to length(subword(line,2))
  112.                uline = insert('-',uline,i,1)
  113.             end
  114.             say strip(uline)
  115.             say
  116.          end
  117.          else do
  118.             if pos("*ATD=",line) > 0 then
  119.                attend = delstr(line,1,5)
  120.             if pos("*RF=",line) > 0 then
  121.                referee = delstr(line,1,4)
  122.             if pos("*HG=",line) > 0 then do
  123.                hct = hct + 1
  124.                home.hct = delstr(line,1,4)
  125.                if pos("(P)",home.hct) > 0 then do
  126.                   lk = pos("(P)",home.hct)
  127.                   home.hct = overlay("pen",home.hct,lk,3)
  128.                end
  129.             end
  130.             if pos("*AG=",line) > 0 then do
  131.                act = act + 1
  132.                away.act = delstr(line,1,4)
  133.                if pos("(P)",away.act) > 0 then do
  134.                   lk = pos("(P)",away.act)
  135.                   away.act = overlay("pen",away.act,lk,3)
  136.                end
  137.             end
  138.             if pos("*HY=",line) > 0 then do
  139.                hct = hct + 1
  140.                home.hct = delstr(line,1,4)" booked."
  141.             end
  142.             if pos("*AY=",line) > 0 then do
  143.                act = act + 1
  144.                away.act = delstr(line,1,4)" booked."
  145.             end
  146.             if pos("*HR=",line) > 0 then do
  147.                hct = hct + 1
  148.                home.hct = delstr(line,1,4)" sent off."
  149.             end
  150.             if pos("*AR=",line) > 0 then do
  151.                act = act + 1
  152.                away.act = delstr(line,1,4)" sent off."
  153.             end
  154.             if pos("*HS=",line) > 0 then do
  155.                hct = hct + 1
  156.                home.hct = delstr(line,1,4)" subs."
  157.             end
  158.             if pos("*AS=",line) > 0 then do
  159.                act = act + 1
  160.                away.act = delstr(line,1,4)" subs."
  161.             end
  162.             if pos("*HM=",line) > 0 then do
  163.                hct = hct + 1
  164.                home.hct = "Man Of Match: "delstr(line,1,4)
  165.             end
  166.             if pos("*AM=",line) > 0 then do
  167.                act = act + 1
  168.                away.act = "Man Of Match: "delstr(line,1,4)
  169.             end
  170.          end
  171.       end
  172.    end
  173.    say "-------------------------------------------------------------------------------"
  174.    close(datafile)
  175. end
  176. else do
  177.    say
  178.    say "ERROR :    (Results)"
  179.    say
  180.    say "Cannot open '"league_file||input_file"' for reading."
  181. end
  182.  
  183. exit